﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace QYmall.Core.Model.ViewModels
{
    /// <summary>
    /// 商品预售(显示)
    /// </summary>
    public class ShopPresellDto : ShopPresellEditDto
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        public long Id { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [StringLength(128)]
        public string? AddBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime AddTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新人
        /// </summary>
        [Display(Name = "更新人")]
        [StringLength(128)]
        public string? UpdateBy { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Display(Name = "更新时间")]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 已删除：0否1是
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte IsDelete { get; set; } = 0;

        /// <summary>
        /// 店铺名称
        /// </summary>
        [Display(Name = "店铺名称")]
        public string? MerchantTitle { get; set; }


        /// <summary>
        /// 商品货品
        /// </summary>
        public ShopGoodsProductListDto? GoodsProduct { get; set; }
    }

    /// <summary>
    /// 商品预售(编辑)
    /// </summary>
    public class ShopPresellEditDto
    {
        /// <summary>
        /// 所属商户ID
        /// </summary>
        [Display(Name = "所属商户")]
        public int MerchantId { get; set; }

        /// <summary>
        /// 货品ID
        /// </summary>
        [Display(Name = "货品ID")]
        public long ProductId { get; set; }

        /// <summary>
        /// 活动开始时间
        /// </summary>
        [Display(Name = "活动开始时间")]
        [Required(ErrorMessage = "{0}不可为空")]
        public DateTime ActStartTime { get; set; }

        /// <summary>
        /// 活动结束时间
        /// </summary>
        [Display(Name = "活动结束时间")]
        [Required(ErrorMessage = "{0}不可为空")]
        public DateTime ActEndTime { get; set; }

        /// <summary>
        /// 尾款支付开始时间
        /// </summary>
        [Display(Name = "尾款支付开始时间")]
        public DateTime PayStartTime { get; set; }

        /// <summary>
        /// 尾款结束开始时间
        /// </summary>
        [Display(Name = "尾款结束开始时间")]
        public DateTime PayEndTime { get; set; }

        /// <summary>
        /// 预售价格
        /// </summary>
        [Display(Name = "预售价格")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal TotalPrice { get; set; } = 0;

        /// <summary>
        /// 预付款
        /// </summary>
        [Display(Name = "预付款")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal FrontAmount { get; set; } = 0;

        /// <summary>
        /// 尾款
        /// </summary>
        [Display(Name = "尾款")]
        [Column(TypeName = "decimal(18, 2)")]
        public decimal RetainAmount { get; set; } = 0;

        /// <summary>
        /// 限购数量0不限制
        /// </summary>
        [Display(Name = "限购数量")]
        public int LimitQuantity { get; set; } = 0;

        /// <summary>
        /// 发货天数
        /// </summary>
        [Display(Name = "发货天数")]
        public int DeliveryDay { get; set; } = 0;

        /// <summary>
        /// 活动标题
        /// </summary>
        [Display(Name = "活动标题")]
        [Required(ErrorMessage = "{0}不可为空")]
        [StringLength(128)]
        public string? Title { get; set; }

        /// <summary>
        /// 活动说明
        /// </summary>
        [Display(Name = "活动简介")]
        [StringLength(512)]
        public string? Remark { get; set; }

        /// <summary>
        /// 状态0开启1关闭
        /// </summary>
        [Display(Name = "状态")]
        [Range(0, 9)]
        public byte Status { get; set; } = 0;

        /// <summary>
        /// 排序数字
        /// </summary>
        [Display(Name = "排序数字")]
        public int SortId { get; set; } = 99;
    }
}
